package com.org.controller.opera;

import com.org.core.annotation.SerializedField;
import com.org.entity.base.PageRequest;
import com.org.entity.base.PageResult;
import com.org.entity.opera.Database;
import com.org.service.opera.DatabaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "api/data/base")
@Api(tags = {"11 DatabaseController"}, description = "数据库服务接口")
public class DatabaseController {

    @Autowired
    private DatabaseService databaseService;

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ApiOperation(value = "获取数据库列表", notes = "获取数据库列表")
    @SerializedField(moduleName = "获取数据库列表")
    public List<Database> getDatabaseList() {
        return databaseService.getDatabaseList();
    }


    @RequestMapping(value = "/page/list", method = RequestMethod.GET)
    @ApiOperation(value = "获取分页数据库列表", notes = "获取分页数据库列表")
    @SerializedField(moduleName = "获取数据库列表")
    public PageResult<Database> getDatabasePageList(PageRequest pageRequest) {
        return databaseService.getDatabasePageList(pageRequest);
    }
}
